package com.ivncorp.evnproject.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.ivncorp.evnproject.R;
import com.ivncorp.evnproject.model.SlidingMenuItem;

public class SlidingMenuAdapter extends ArrayAdapter<SlidingMenuItem> {
	
	public SlidingMenuAdapter(Context context) {
		super(context, 0);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = LayoutInflater.from(getContext()).inflate(R.layout.slidingmenu_item, null);
		}
         
        ImageView imgIcon = (ImageView) convertView.findViewById(R.id.icon);
        TextView txtTitle = (TextView) convertView.findViewById(R.id.title);
        
         
        imgIcon.setImageResource(getItem(position).getIcon());        
        txtTitle.setText(getItem(position).getTitle());
        
        
        
        return convertView;
	}

}
